package com.zhangh.summer.admin.support.session;

/**
 * @description: TODO
 * @author: zhanghui  zhanghlucky@163.com
 * @create: 2021-06-10 18:16
 **/

public class SysSession {

    private static  ThreadLocal<SessionUser> local = new ThreadLocal<SessionUser>();

    private static ThreadLocal<String> traceLocal=new ThreadLocal<>();

    public static SessionUser getUser() {
        if (null==local.get()){
            SessionUser emptyUser=SessionUser.emptyUser();
            return emptyUser;
        }
        return local.get();
    }
    public static void setUser(SessionUser sessionUser) {
        local.set(sessionUser);
    }

    public static String getTraceID(){
        return traceLocal.get();
    }
    public static void setTraceID(String traceID){
        traceLocal.set(traceID);
    }

    public static String getSysUser(){
        return "system";
    }
}
